<template>
	<div>
		<mytable :users='user' :totals="6" :checkedArr="checkedArr" :userHeader='userHeader' @pageChange="pageChange" @valueChange="valueChange">
			<button slot="list" @click="importMoban">导入模板</button>
		</mytable>
	</div>
</template>

<script>
	import table from './table.vue'
	export default {
		data() {
				return {
          checkedArr: [],
					userHeader: [{
						name: '名字',
						key: 'name'
					}, {
						name: '手机',
						key: 'phone',
						type: 'link',
						url: 'www.baidu.com'
					}],
					user: [],
					user1: [{
						name: '张三',
						phone: '1357046513',
						id: 213
					}, {
						name: '李四',
						phone: '1357046513',
						id: 23213
					}, {
						name: '赵武',
						phone: '1357046513',
						id: 2312321
					}],
					user2: [{
						name: '巴巴',
						phone: '1357046513',
						id: 3343413
					}, {
						name: '等待',
						phone: '1357046513',
						id: 7893213
					}, {
						name: '呵呵',
						phone: '1357046513',
						id: 9009012321
					}],
					user3: [{
						name: 'dsadsdsd',
						phone: '1357046513',
						id: 213
					}, {
						name: '李四',
						phone: '1357046513',
						id: 23213
					}, {
						name: '赵武',
						phone: '1357046513',
						id: 2312321
					}]
				}
			},
			components: {
				mytable: table
			},
			mounted() {
				setTimeout(() => {
					this.user = this.user1
				}, 1000);
			},
			methods: {
				pageChange(val) {
					setTimeout(() => {
						if(val === 1) {
							this.user = this.user1
						} else {
							this.user = this.user2
						}
					}, 0)
				},
				importMoban() {
					this.checkedArr = [213]
				},
				valueChange(val) {
          this.checkedArr = val
					console.log('传出去的arr1', val)
				}
			}
	}
</script>